<template>
	<view class="container bg-white border-t1" v-if="info.id">		
		<view class="p-30">
			<view class="fs15 fw600 m-b30 m-t20">{{ info.title }}</view>
			<view class="uni-flex justify-space-between m-b20 article_icons">
				<view class="fs12 text-gray6">发布时间：{{ info.create_time }}</view>
				<view class="fs12 uni-flex justify-left">
					<uni-icons type="eye" color="#666" size="18"></uni-icons>
					<text class="m-l10 text-gray6">{{ info.view_num }}</text>
				</view>
			</view>
			
			<view class="case_rich">
				<rich-text :selectable="true" :nodes="info.content"></rich-text>
			</view>
		</view>
	</view>
</template>
<script>
import { articleList, articleDetail } from "@/api/article.js"
import richTextUtil from '@/common/js/richTextUtil.js'
let that;
export default {
	data() {
		return {
			code: "",		//文章code
			info: {},	
		}
	},
	onLoad(e){
		that = this
		that.code = e.code ? e.code : ""
		if(that.code){
			that.getDetail()
		}
	},
	methods: {		
		/**
		 * 根据分类获取文章列表
		 */
		getDetail() {
			articleDetail({ code: that.code }).then(res => {
				that.info = res.data
				that.info.content = richTextUtil.formatRichText(that.info.content)
			})
		},
	},
}
</script>

<style>
.container {
	min-height: 100vh;
}
.article_icons {
	line-height: 60rpx;
}
</style>